package Persistencia;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;
import Negocio.Professor;


public class PersistirDados {
	
	
		

		public static  void salvaProfessor(List<Professor> listaProf) throws FileNotFoundException, IOException {
			ObjectOutputStream out= new ObjectOutputStream(new FileOutputStream("salvo.txt"));
			out.writeObject(listaProf);

		}
		

		@SuppressWarnings("unchecked")
		public static List<Professor> recuperaUsandoArquivos()throws FileNotFoundException, IOException, ClassNotFoundException{
			ObjectInputStream in =new ObjectInputStream(new FileInputStream("salvo.txt"));
			List<Professor> departamento = (List<Professor>) in.readObject();
			return (List<Professor>) departamento;
		}

	}


